**************************************************************************************
**Title:Regional manufacturing composition and political (dis)content in Europe 
** Authors: Anders Ejrnæs and Mads Dagnis Jensen
** Purpose: Replication
** Date november 2023
** software:	Stata/MP 18.0 



use "C:\Users\ejrnaes\Dropbox\Public Attitudes\Our papers\regional discontent\JEPP final\Final_replication\replication_data.dta"

********
* Table 1: The hybrid multilevel model explaining satisfaction and trust
 eststo clear 
mixed  stfgov  zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo 
mixed  Political_trust3 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo 
mixed  Political_trust3 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode stfgov i.year  i.Country_num|| Nuts_num:|| year:
eststo
esttab using table1.rtf  , not wide compress b(%9.3f) n transform(ln*: exp(2*@) 2*exp(2*@)) indicate(" Country FE = *.Country_num "  " Year FE = *.year ")

*Table 2: Multilevel regression with cross-level interaction
eststo clear
mixed  stfgov zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs economic_deprivation paid_work  i.brncntr i.gndr i.domicil_recode i.class5_r  c.zshare_ind_diff#gndr c.zshare_ind_diff#brncnt c.zshare_ind_diff#class5_r  c.zshare_ind_diff#domicil_recode     i.year  i.Country_num|| Nuts_num:|| year:
eststo 
mixed  Political_trust3 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs economic_deprivation paid_work  i.brncntr i.gndr i.domicil_recode i.class5_r  c.zshare_ind_diff#gndr c.zshare_ind_diff#brncnt c.zshare_ind_diff#class5_r  c.zshare_ind_diff#domicil_recode     i.year  i.Country_num|| Nuts_num:|| year:
eststo
esttab using Table2.rtf , not wide compress b(%9.3f) n transform(ln*: exp(2*@) 2*exp(2*@)) indicate(" Country FE = *.Country_num "  " Year FE = *.year ")

*figure 4a-f
margins class5_r, at(zshare_ind_diff=(-2 -1 0 1 2)) plot(allxlabels nolabels)
margins class5_r, at(zshare_ind_diff=(-2 -1 0 1 2)) plot
margins class5_r, at(zshare_ind_diff=(-2 -1 0 1 2)) plot
margins domicil_recode , at(zshare_ind_diff=(-2 -1 0 1 2)) plot
margins domicil_recode , at(zshare_ind_diff=(-2 -1 0 1 2)) plot
margins brncntr , at(zshare_ind_diff=(-2 -1 0 1 2)) plot
margins brncntr , at(zshare_ind_diff=(-2 -1 0 1 2)) plot

*Online supporting material

***Table 3A three level without decomposing, fixed efffect and hybrid  (unstandardized_coeficient)


mixed stfgov share_ind_percent  gdp_pr_capita unemployement  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode  i.year || Nuts_num:|| year:

xtreg stfgov share_ind_percent  gdp_pr_capita unemployement  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode  i.year, fe


mixed  stfgov  share_ind_Diff_percent gdp_pr_capita_diff  unemployment_diff zgdp_pr_capita_diff agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  || Nuts_num:|| year:

 

mixed Political_trust3 share_ind_percent  gdp_pr_capita unemployement  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode  i.year || Nuts_num:|| year:

xtreg Political_trust3 share_ind_percent  gdp_pr_capita unemployement  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode  i.year, fe


mixed  Political_trust3 share_ind_Diff_percent gdp_pr_capita_diff  unemployment_diff zgdp_pr_capita_diff agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  || Nuts_num:|| year:



**** Table A4 Other branches
***Table A4: Hybrid model explaining the effect of different sectors on satisfaction with government
 eststo clear
mixed  stfgov zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo 
mixed  stfgov zshare_agriculture_mean  zunemployement_mean zgdp_pr_capita_mean zshare_agriculture_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo 
mixed  stfgov zshare_construction_mean  zunemployement_mean zgdp_pr_capita_mean zshare_construction_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo 
mixed  stfgov zshare_service_all_mean  zunemployement_mean zgdp_pr_capita_mean zshare_service_all_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo 
mixed  stfgov zshare_ind_mean zshare_agriculture_mean zunemployement_mean zshare_construction_mean zshare_service_all_mean zgdp_pr_capita_mean zshare_ind_diff zshare_agriculture_diff zshare_construction_diff zshare_service_all_diff zunemployment_diff zgdp_pr_capita_diff    agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
esttab using TableA4  , not wide compress b(%9.3f) n transform(ln*: exp(2*@) 2*exp(2*@)) indicate(" Country FE = *.Country_num "  " Year FE = *.year ")

** *** Table A5 Hybrid model explaining the effect of different sectors on political trust 
  eststo clear
mixed   Political_trust3 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo 
mixed   Political_trust3 zshare_agriculture_mean  zunemployement_mean zgdp_pr_capita_mean zshare_agriculture_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo 
mixed   Political_trust3 zshare_construction_mean  zunemployement_mean zgdp_pr_capita_mean zshare_construction_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo 
mixed   Political_trust3 zshare_service_all_mean  zunemployement_mean zgdp_pr_capita_mean zshare_service_all_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo
esttab using Table5A  , not wide compress b(%9.3f) n transform(ln*: exp(2*@) 2*exp(2*@)) indicate(" Country FE = *.Country_num "  " Year FE = *.year ")


*** other indicators 
***Table A6: Explaining satisfaction/ approval of democracy, economy, EU integration and immigrants  
eststo clear
mixed  stfdem zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo 
mixed  stfeco zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo  
mixed euftf zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:

eststo 
mixed immigrant_attitude zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo
esttab using tableA6.rtf  , not wide compress b(%9.3f) n transform(ln*: exp(2*@) 2*exp(2*@)) indicate(" Country FE = *.Country_num "  " Year FE = *.year ")


****Table A7: Hybrid multilevel model with interacting level and change in share of industrial employment explaining satisfaction and trust.
**** Interacting different level

eststo clear
mixed  stfgov zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean c.zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff c.zshare_ind_diff#c.zshare_ind_mean  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo 


mixed  Political_trust3 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean c.zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff c.zshare_ind_diff#c.zshare_ind_mean  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:

eststo
esttab using TableA7.rtf  , not wide compress b(%9.3f) n transform(ln*: exp(2*@) 2*exp(2*@)) indicate(" Country FE = *.Country_num "  " Year FE = *.year ")


*Table A8: The hybrid multilevel model with quadratic functions explaining satisfaction and trust
*including quadratic terms
eststo clear
mixed  stfgov c.zshare_ind_mean##c.zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean c.zshare_ind_diff##c.zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:

eststo
mixed  Political_trust3  c.zshare_ind_mean##c.zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean c.zshare_ind_diff##c.zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo
esttab using TableA8.rtf  , not wide compress b(%9.3f) n transform(ln*: exp(2*@) 2*exp(2*@)) indicate(" Country FE = *.Country_num "  " Year FE = *.year ")


***Table A9: Explaining political trust with satisfaction with economy as mediating variable 

eststo clear
mixed  stfeco zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr i.year  i.Country_num|| Nuts_num:|| year:
eststo

mixed  Political_trust3 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo 
mixed  Political_trust3 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode stfeco i.year  i.Country_num|| Nuts_num:|| year:
eststo

esttab using TableA9.rtf  , not wide compress b(%9.3f) n transform(ln*: exp(2*@) 2*exp(2*@)) indicate(" Country FE = *.Country_num "  " Year FE = *.year ")


*Table A10: Hybrid interaction model using alternative moderators 
** different moderating variable 
** education
eststo clear
mixed  stfgov zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs economic_deprivation paid_work  i.brncntr i.gndr i.domicil_recode i.class5_r  c.zshare_ind_diff#gndr c.zshare_ind_diff#brncnt   c.zshare_ind_diff#domicil_recode  c.zshare_ind_diff#c.eduyrs   i.year  i.Country_num|| Nuts_num:|| year:
eststo

mixed Political_trust3 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs economic_deprivation paid_work  i.brncntr i.gndr i.domicil_recode i.class5_r  c.zshare_ind_diff#gndr c.zshare_ind_diff#brncnt   c.zshare_ind_diff#domicil_recode  c.zshare_ind_diff#c.eduyrs   i.year  i.Country_num|| Nuts_num:|| year:
eststo


*perceived economic deprivation

mixed  stfgov zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs economic_deprivation paid_work  i.brncntr i.gndr i.domicil_recode i.class5_r  c.zshare_ind_diff#gndr c.zshare_ind_diff#brncnt   c.zshare_ind_diff#domicil_recode  c.zshare_ind_diff#c.economic_deprivation   i.year  i.Country_num|| Nuts_num:|| year:
eststo
mixed Political_trust3 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs economic_deprivation paid_work  i.brncntr i.gndr i.domicil_recode i.class5_r  c.zshare_ind_diff#gndr c.zshare_ind_diff#brncnt   c.zshare_ind_diff#domicil_recode  c.zshare_ind_diff#c.economic_deprivation   i.year  i.Country_num|| Nuts_num:|| year:
eststo

esttab using Table10A.rtf  , not wide compress b(%9.3f) n transform(ln*: exp(2*@) 2*exp(2*@)) indicate(" Country FE = *.Country_num "  " Year FE = *.year ") 

**Table A11: Multilevel hybrid model (western Europe)

 eststo clear
mixed  stfgov zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num if east_west==1|| Nuts_num:|| year:
eststo 
mixed  Political_trust3 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num if east_west==1|| Nuts_num:|| year:
eststo 
mixed  Political_trust3 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode stfgov i.year  i.Country_num if east_west==1|| Nuts_num:|| year:
eststo
esttab using tableA11.rtf  , not wide compress b(%9.3f) n transform(ln*: exp(2*@) 2*exp(2*@)) indicate(" Country FE = *.Country_num "  " Year FE = *.year ")


*Table A12: Multilevel regression Eastern Europe

 eststo clear
mixed  stfgov zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  if east_west==2|| Nuts_num:|| year:
eststo 
mixed  Political_trust3 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr domicil_recode i.gndr i.year  if east_west==2|| Nuts_num:|| year:
eststo 
mixed  Political_trust3 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode stfgov i.year  if east_west==2|| Nuts_num:|| year:
eststo
esttab using tableA12.rtf  , not wide compress b(%9.3f) n transform(ln*: exp(2*@) 2*exp(2*@)) indicate( " Year FE = *.year ")

*Table 13A: Multilevel hybrid model with unemployment and GDP as mediating variable

eststo clear
mixed  stfgov zshare_ind_mean   zshare_ind_diff    agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo 

 eststo clear
mixed  stfgov   zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo

mixed  Political_trust3 zshare_ind_mean   zshare_ind_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo 

mixed  Political_trust3 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode i.year  i.Country_num|| Nuts_num:|| year:
eststo 


esttab using table13A.rtf  , not wide compress b(%9.3f) n transform(ln*: exp(2*@) 2*exp(2*@)) indicate(" Country FE = *.Country_num "  " Year FE = *.year ") 


**Table 14A: Multilevel hybrid model with moderators Using a alternative class model which distinguish between unskilled manufacturing works and unskilled service workers. 
eststo clear

mixed stfgov zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs economic_deprivation paid_work  i.brncntr i.gndr i.domicil_recode i.class8_r  c.zshare_ind_diff#gndr c.zshare_ind_diff#brncnt   c.zshare_ind_diff#domicil_recode  c.zshare_ind_diff#c.economic_deprivation   i.year  i.Country_num|| Nuts_num:|| year:
eststo

mixed Political_trust3 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs economic_deprivation paid_work  i.brncntr i.gndr i.domicil_recode i.class8_r  c.zshare_ind_diff#gndr c.zshare_ind_diff#brncnt   c.zshare_ind_diff#domicil_recode  c.zshare_ind_diff#c.economic_deprivation   i.year  i.Country_num|| Nuts_num:|| year:
eststo
esttab using table14A.rtf  , not wide compress b(%9.3f) n transform(ln*: exp(2*@) 2*exp(2*@)) indicate(" Country FE = *.Country_num "  " Year FE = *.year ") 



**Table 15A: Multilevel hybrid model with additive index trust in political institutions and actors. 
eststo clear
mixed  Political_trust4 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs i.class5_r economic_deprivation paid_work  i.brncntr i.gndr domicil_recode  i.year  i.Country_num|| Nuts_num:|| year:
eststo

mixed  Political_trust4 zshare_ind_mean  zunemployement_mean zgdp_pr_capita_mean zshare_ind_diff zunemployment_diff zgdp_pr_capita_diff  agea eduyrs economic_deprivation paid_work  i.brncntr i.gndr i.domicil_recode i.class5_r  c.zshare_ind_diff#gndr c.zshare_ind_diff#brncnt c.zshare_ind_diff#class5_r  c.zshare_ind_diff#domicil_recode     i.year  i.Country_num|| Nuts_num:|| year:
eststo
esttab using Table15A.rtf , not wide compress b(%9.3f) n transform(ln*: exp(2*@) 2*exp(2*@)) indicate(" Country FE = *.Country_num "  " Year FE = *.year ")




